{% extends "base.html" %}

{% block title %}添加字典项 - 网站管理后台{% endblock %}

{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
    <h1 class="h2">添加字典项</h1>
</div>

<div class="row mb-3">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h5>字典信息</h5>
            </div>
            <div class="card-body">
                <p><strong>编码:</strong> {{ dictionary[1] }}</p>
                <p><strong>名称:</strong> {{ dictionary[2] }}</p>
                <p><strong>分类:</strong> {{ dictionary[3] or '-' }}</p>
                <p><strong>描述:</strong> {{ dictionary[4] or '-' }}</p>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-6">
        <form method="POST">
            <div class="mb-3">
                <label for="code" class="form-label">编码</label>
                <input type="text" class="form-control" id="code" name="code" required>
            </div>
            <div class="mb-3">
                <label for="label" class="form-label">标签</label>
                <input type="text" class="form-control" id="label" name="label" required>
            </div>
            <div class="mb-3">
                <label for="value" class="form-label">值</label>
                <input type="text" class="form-control" id="value" name="value">
            </div>
            <div class="mb-3">
                <label for="description" class="form-label">描述</label>
                <textarea class="form-control" id="description" name="description" rows="3"></textarea>
            </div>
            <div class="mb-3">
                <label for="sort_order" class="form-label">排序</label>
                <input type="number" class="form-control" id="sort_order" name="sort_order" value="0">
            </div>
            <div class="mb-3 form-check">
                <input type="checkbox" class="form-check-input" id="status" name="status" checked>
                <label class="form-check-label" for="status">启用</label>
            </div>
            <button type="submit" class="btn btn-primary">添加字典项</button>
            <a href="{{ url_for('web.dictionary_items', dictionary_id=dictionary[0]) }}" class="btn btn-secondary">取消</a>
        </form>
    </div>
</div>
{% endblock %}